fix(safeguarding): GATE0 case 2 safeguarding state; widen phrasebank selector for PROFESSIONAL - #19
Merged
Conversation
…sebank selector for PROFESSIONAL variant Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
james-cross
reviewed
May 5, 2026
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Collaborator
Author
|
Regression test added per review — Crisis gate option 2 › GATE0 option 2 sets safeguardingTriggered and safeguardingType before LA prompt — placed between the existing "Under 16" and "16-17 Year Olds" describe blocks. 97/97 passing locally. Separately: noticed npm run check doesn't include jest, so the project rule "run npm run check before every commit" wasn't actually catching test failures. Will raise a small follow-up PR to add jest to the check script. Out of scope for this PR. |
james-cross
approved these changes
May 13, 2026
camlambert2000
added a commit
that referenced
this pull request
May 14, 2026
…r at exit call sites Prerequisite structural change for PR #20. PR #19 widened the selector to accept userType but call sites were not yet passing it. Without this wiring, the __PROFESSIONAL phrasebank entries added in subsequent commits would be dead code at the moment of merge. No behavioural change in this commit: __PROFESSIONAL entries do not yet exist, so the selector falls back to __SUPPORTER as before. Tests pass unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
camlambert2000
added a commit
that referenced
this pull request
May 19, 2026
…ew tidy-ups recorded Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lib/handlers/crisis.ts:217). Selecting "Under 16 and need protection" now setssafeguardingTriggered: trueandsafeguardingType: 'UNDER_16'on the transition toCRISIS_UNDER16_LOCATION. Previously the flag was only set atbuildUnder16Exit(after the LA prompt), leaving sessions that abandon at the location prompt invisible to safeguarding telemetry.userType(lib/phrasebank.ts:2390,lib/stateMachine.ts:163,lib/handlers/shared.ts:15).getPhraseand the twophrase()wrappers now accept'SELF' | 'SUPPORTER' | 'PROFESSIONAL' | null | boolean. Selection rules:'PROFESSIONAL'looks for__PROFESSIONALfirst, falls back to__SUPPORTER, then base;'SUPPORTER'ortruelooks for__SUPPORTERthen base; everything else returns base. Backwards-compatible — every existing caller still passessession.isSupporter(boolean) and resolves identically to before.Pending
__PROFESSIONALphrasebank entries are not in this PR — they are pending James's language sign-off and will follow in PR #20. Until those entries land, professional users continue to resolve to the__SUPPORTERfallback (same behaviour as before this PR). The selector is in place so PR #20 only needs to add content.Test plan
npm test— 96 / 96 pass locally, including under-16 safeguarding paths and supporter-mode tests.safeguardingTriggered: truein the session payload (app/api/chat/route.ts:352).🤖 Generated with Claude Code